function ADDR(width, height, pos, addr, callbackFunc) {
  this._width = width;
  this._height = height;
  this._pos = pos;
  this._addr = addr;
  this._callbackFunc = callbackFunc;
  this._create();
};

ADDR.prototype._create = function() {
  var _pop, div, elm2, elm, _self = this;
  
  _pop = new Pop({
    p: this._pos,
    b: 1,
    w: this._width,
    h: this._height,
    t: (!this._addr.id) ? 'New Address' : 'Edit Address'
  });
  
  div = document.createElement('div');
  div.className = 'content';
  _pop.append(div);
  
  var tr, td, th, input;
  this._table = document.createElement('table');
  this._table.cellPadding=0;
  this._table.cellSpacing=0;
  div.appendChild(this._table);
  this._table.className = 'form2';
  this._table.style.width = '600px';
  
  
  tr = this._table.insertRow(-1);
  td = tr.insertCell(-1);
  td.className = 'title';
  td.appendChild(document.createTextNode('First Name'));
  td = tr.insertCell(-1);
  td.className = 'content';
  input = document.createElement('input');
  input.id = 'first_name';
  input.type = 'text';
  input.value = this._addr.first_name;
  input.onchange = function() {
    _self._addr.first_name = this.value;
  }
  td.appendChild(input);
  
  tr = this._table.insertRow(-1);
  td = tr.insertCell(-1);
  td.className = 'title';
  td.appendChild(document.createTextNode('Last Name'));
  td = tr.insertCell(-1);
  td.className = 'content';
  input = document.createElement('input');
  input.id = 'last_name';
  input.type = 'text';
  input.value = this._addr.last_name;
  input.onchange = function() {
    _self._addr.last_name = this.value;
  }
  td.appendChild(input);
  
  tr = this._table.insertRow(-1);
  td = tr.insertCell(-1);
  td.className = 'title';
  td.appendChild(document.createTextNode('Address1'));
  td = tr.insertCell(-1);
  td.className = 'content';
  input = document.createElement('input');
  input.id = 'address1';
  input.type = 'text';
  input.value = this._addr.address1;
  input.onchange = function() {
    _self._addr.address1 = this.value;
  }
  td.appendChild(input);
  
  tr = this._table.insertRow(-1);
  td = tr.insertCell(-1);
  td.className = 'title';
  td.appendChild(document.createTextNode('Address2'));
  td = tr.insertCell(-1);
  td.className = 'content';
  input = document.createElement('input');
  input.id = 'address2';
  input.type = 'text';
  input.value = this._addr.address2;
  input.onchange = function() {
    _self._addr.address2 = this.value;
  }
  td.appendChild(input);
  
  tr = this._table.insertRow(-1);
  td = tr.insertCell(-1);
  td.className = 'title';
  td.appendChild(document.createTextNode('City'));
  td = tr.insertCell(-1);
  td.className = 'content';
  input = document.createElement('input');
  input.id = 'city';
  input.type = 'text';
  input.value = this._addr.city;
  input.onchange = function() {
    _self._addr.city = this.value;
  }
  td.appendChild(input);
  
  tr = this._table.insertRow(-1);
  td = tr.insertCell(-1);
  td.className = 'title';
  td.appendChild(document.createTextNode('Country'));
  td = tr.insertCell(-1);
  td.className = 'content';
  input = document.createElement('input');
  input.id = 'country';
  input.type = 'text';
  input.value = this._addr.country;
  input.onchange = function() {
    _self._addr.country = this.value;
  }
  td.appendChild(input);
  
  tr = this._table.insertRow(-1);
  td = tr.insertCell(-1);
  td.className = 'title';
  td.appendChild(document.createTextNode('Zip'));
  td = tr.insertCell(-1);
  td.className = 'content';
  input = document.createElement('input');
  input.id = 'zip';
  input.type = 'text';
  input.value = this._addr.zip;
  input.onchange = function() {
    _self._addr.zip = this.value;
  }
  td.appendChild(input);
  
  tr = this._table.insertRow(-1);
  td = tr.insertCell(-1);
  td.className = 'title';
  td.appendChild(document.createTextNode('Phone'));
  td = tr.insertCell(-1);
  td.className = 'content';
  input = document.createElement('input');
  input.id = 'phone';
  input.type = 'text';
  input.value = this._addr.phone;
  input.onchange = function() {
    _self._addr.phone = this.value;
  }
  td.appendChild(input);
  
  tr = this._table.insertRow(-1);
  td = tr.insertCell(-1);
  td.className = 'title';
  td.appendChild(document.createTextNode('Email'));
  td = tr.insertCell(-1);
  td.className = 'content';
  input = document.createElement('input');
  input.id = 'email';
  input.type = 'text';
  input.value = this._addr.email;
  input.onchange = function() {
    _self._addr.email = this.value;
  }
  td.appendChild(input);
  
  
  var tmp_div = document.createElement('div');
  tmp_div.style.marginTop = '15px';
  tmp_div.style.textAlign = 'center';
  div.appendChild(tmp_div);
  elm = document.createElement('button');
  elm.className='imgbtn ok';
  elm.appendChild(document.createTextNode('OK'));
  elm.onclick = function() {
    _pop.close();
    _self._callbackFunc(_self._addr);
  }
  tmp_div.appendChild(elm);
  
  elm = document.createElement('button');
  elm.className='imgbtn cancel';
  elm.appendChild(document.createTextNode('Cancel'));
  elm.onclick = function() {
    _pop.close();
  }
  tmp_div.appendChild(elm);
};

